package com.phale.domain;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;



public class ItemDao {
	public static Item findItem(String keyString) {
		EntityManager mag = EMF.get().createEntityManager();
		Item item = mag.find(Item.class, keyString);
		return item;
	}
	
	public static List<Item> findAllItems(){
		EntityManager mag = EMF.get().createEntityManager();
		Query q = mag.createQuery("SELECT i from Item i");
		@SuppressWarnings("unchecked")
		List<Item> list = q.getResultList();
		return list;
	}
}
